package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.ScenicSpot;
import com.ruoyi.system.mapper.ScenicSpotMapper;
import com.ruoyi.system.service.IScenicSpotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: ZCJ
 * @date: 2024/06/24/10:28
 * @desc:
 */
@Service
public class ScenicSpotServiceImpl implements IScenicSpotService {
    @Autowired
    private ScenicSpotMapper scenicSpotMapper;

    /**
     * 查询所有景点
     * @return
     */
    @Override
    public AjaxResult getAllSpots() {
        List<ScenicSpot> allSpots = scenicSpotMapper.getAllSpots();
        return AjaxResult.success(allSpots);
    }

    /**
     * 根据景点id查询景点信息
     * @param spotId
     * @return
     */
    @Override
    public AjaxResult getSpotById(Integer spotId) {
        ScenicSpot spot = scenicSpotMapper.getSpotById(spotId);
        return AjaxResult.success(spot);
    }

    /**
     * 根据景点名称进行模糊匹配查询景点信息
     * @param spotName
     * @return
     */
    @Override
    public List<ScenicSpot> getSpotByName(Integer areaId, String spotName) {
        return scenicSpotMapper.getSpotListByName(areaId, spotName);
    }
}
